package com.google.oop2;

import java.util.Objects;
import java.util.Scanner;

/**
 * @author Mucd
 * @Date 2020/12/15
 * @Class Main
 */
public class Main {
    public static void main(String[] args) {

        gou();

    }

    /**
     * 对象调用
     */
    public static void fang() {
        Scanner sc = new Scanner(System.in);
        System.out.println("输入年龄");
        int scAge = sc.nextInt();

        System.out.println("输入姓名");
        String scName = sc.next();

        System.out.println("输入性别");
        String scSex = sc.next();

        Student student = new Student();
        student.setName(scName);
        student.setAge(scAge);
        student.setSex(scSex);
        student.read();
    }

    /**
     * 构造方法
     */
    public static void gou() {
        Scanner sc = new Scanner(System.in);
        System.out.println("输入年龄");
        int scAge = sc.nextInt();

        System.out.println("输入姓名");
        String scName = sc.next();

        System.out.println("输入性别");
        String scSex = sc.next();

        if (scName != " " && scName != null && scAge > 0 && Objects.equals(scSex,"男") || Objects.equals(scSex, "女")) {
            Student s = new Student(scName, scAge, scSex);
        }else{
            System.out.println("输入正确信息·");
            System.out.println("重新输入");
            gou();
        }
    }
}
